1. Field of the Invention
The present invention generally relates to cache organization and more particularly to dynamic cache partitioning.
2. Description of the Related Art
In a computer system, a cache is the first level of memory hierarchy encountered once an address leaves a processor toward a memory subsystem. A cache uses the principle of locality to buffer commonly used addresses. Caches improve system performance by reducing memory access latencies and by reducing bandwidth consumption on a processor front side bus. A cache operates on a processor backside bus with processors such as Intel's Pentium III Xeon processor. Many of today's processors include integrated level-one (L1) and level-two (L2) caches. Computer systems can employ a cache external to the processor in addition to these internal caches.
Modern operating systems can issue multiple threads and processes that may share a cache. When a thread or process is pre-empted, the new thread or process could replace the cache contents of the previous thread or process. When the original thread or process returns, its memory ranges may no longer be cached. The original thread or process may then cache its memory ranges and replace what was cached by the previous thread or process. This behavior is termed “thrashing” a cache. Operating systems and more generally the overall software model of computer systems can significantly contribute to cache thrashing.
Multi-processor computer systems in which multiple processors share a cache also greatly contribute to cache thrashing. For instance, a context switch may occur that shifts to a process for a processor after a previous process for a different processor was cached. Similarly, when logical processors become available from a single physical processor package, threads or processes for one logical processor will likely pre-empt previous threads or processes of another logical processor and replace the cache contents of these previous threads or processes.
Increasing the associativity of caches, optimizing process or thread scheduling and optimizing memory management are common strategies employed in an effort to address cache thrashing.